#include <REGX52.H>
#include "intrins.h"
#include "key.h"
#include "timer.h"
unsigned char keysnum,ledsport;
void main(){
	Timer0Init();
	P2=0xfe;
	while(1){
		keysnum=key();
		if(keysnum){
				ledsport++;
			if(ledsport==2)
				ledsport=0;
			}
		}
	}
void Int0_Timer()  interrupt 1
	{
	static unsigned int count;
	TL0 = 0x18;		//设置定时初值
	TH0 = 0xFC;
	count++;
	if(count==500){
		count=0;
		if(ledsport==0)
			P2=_crol_(P2,1);
		if(ledsport==1)
			P2=_cror_(P2,1);
	}
}

